In [1]:
import numpy as np
import pandas as pd
from sklearn.utils import resample
In [2]:
mat = np.arange(45).reshape(-1,3)
mat
Out[2]:
In [3]:
df = pd.DataFrame(np.nan, index = range(1500), columns = list('abc'))
In [4]:
cnt = 5
for i in range(300):
df.iloc[cnt-5:cnt,:] = resample(mat,n_samples = 5, replace = True)
cnt += 5
df.head()
Out[4]:
In [5]:
cnt = 5
for i in range(300):
df.iloc[cnt-5:cnt,:] = resample(mat,n_samples = 5, replace = True) + np.random.randint(3, size=(5,3))
cnt += 5
df.head()
Out[5]: